// eslint-disable-next-line
import { UserLayout, BasicLayout, PageView } from '@/layouts'
import * as Icon from '@/core/icons'
const RouteView = {
  name: 'RouteView',
  render: (h) => h('router-view')
}
export const asyncRouterMap = [

  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '超级管理后台' },
    redirect: '/store/index',
    children: [
      {
        name: 'store',
        path: 'store',
        redirect: 'store',
        component: PageView,
        meta: { title: '商城管理', keepAlive: true, icon: Icon['shop'] },
        children: [
          {
            path: 'index',
            component: () => import(/* webpackChunkName: "store" */ '@/views/store/index'),
            meta: { title: '商城列表', keepAlive: true, hiddenHeaderContent: false, permission: ['/store/index'] }
          },
          {
            path: 'zone/index',
            component: () => import(/* webpackChunkName: "store" */ '@/views/store/zone/index'),
            meta: { title: '区域列表', keepAlive: true, permission: ['zone/index'] }
          }
        ]
      },
      {
        name: 'Order',
        path: 'order',
        redirect: '/order/index',
        component: PageView,
        meta: { title: '订单管理', keepAlive: true, icon: Icon['shop'] },
        children: [
          {
            path: 'index',
            component: () => import(/* webpackChunkName: "order" */ '@/views/order/index'),
            meta: { title: '订单列表', keepAlive: false, hiddenHeaderContent: false, permission: ['order/index'] }
          },
          {
            path: '/order/detail',
            component: () => import(/* webpackChunkName: "order" */ '@/views/order/detail'),
            meta: { title: '订单详情', keepAlive: false, permission: ['/order/detail'] },
            hidden: true
          }
        ]
      },
      {
        name: 'Client',
        path: 'client',
        redirect: '/client/register',
        component: PageView,
        meta: { title: '客户端管理', keepAlive: true, icon: Icon['shop'], permission: ['client'] },
        children: [
          {
            path: 'register',
            component: () => import(/* webpackChunkName: "order" */ '@/views/client/register'),
            meta: { title: '注册设置', keepAlive: false, hiddenHeaderContent: false, permission: ['client'] }
          },
          {
            path: 'wxapp/setting',
            component: () => import(/* webpackChunkName: "order" */ '@/views/client/wxapp/setting'),
            meta: { title: '小程序设置', keepAlive: false, hiddenHeaderContent: false, permission: ['client'] }
          },
          {
            path: 'h5/setting',
            component: () => import(/* webpackChunkName: "order" */ '@/views/client/h5/setting'),
            meta: { title: 'H5设置', keepAlive: false, hiddenHeaderContent: false, permission: ['client'] }
          }
        ]
      },
      {
        name: 'Menu',
        path: 'menu',
        redirect: '/menu/index',
        component: PageView,
        meta: { title: '菜单管理', keepAlive: true, icon: Icon['menu'], permission: ['access'] },
        children: [
          {
            path: '/menu/index',
            component: () => import(/* webpackChunkName: "menu" */ '@/views/menu/index'),
            meta: { title: '菜单列表', keepAlive: true, permission: ['access'] }
          },
          {
            path: '/menu/access/index',
            component: () => import(/* webpackChunkName: "menu" */ '@/views/menu/access/index'),
            meta: { title: 'API权限', keepAlive: true, permission: ['access'] }
          }
        ]
      },
      // 会员管理
       {
         path: '/user',
         name: 'user',
         component: RouteView,
         meta: { title: '会员管理', icon: Icon.user, permission: ['/user'] },
         children: [
           {
             path: '/user/index',
             component: () => import(/* webpackChunkName: "user" */ '@/views/user/Index'),
             meta: { title: '会员列表', keepAlive: false, permission: ['/user/Index'] }
           },
           /*{
             path: 'dept/index',
             component: () => import(/!* webpackChunkName: "store" *!/ '@/views/user/dept/index'),
             meta: { title: '部门管理', keepAlive: true, permission: ['dept/index'] }
           },*/
           /*{
             path: '/user/grade/index',
             component: () => import(/!* webpackChunkName: "user" *!/ '@/views/user/grade/Index'),
             meta: { title: '会员等级', keepAlive: false, permission: ['/user/grade/index'] },
             moduleKey: 'user-grade'
           },*/
           {
             path: '/user/balance',
             component: RouteView,
             redirect: '/user/balance/index',
             meta: { title: '余额记录', keepAlive: false, permission: ['/user/balance'] },
             moduleKey: 'user-balance',
             children: [
               {
                 path: '/user/recharge/index',
                 component: () => import(/* webpackChunkName: "content" */ '@/views/user/recharge/Index'),
                 meta: { title: '充值记录', keepAlive: false, permission: ['/user/recharge/index'] }
               },
               {
                 path: '/user/balance/index',
                 component: () => import(/* webpackChunkName: "content" */ '@/views/user/balance/Index'),
                 meta: { title: '余额明细', keepAlive: false, permission: ['/user/balance/index'] }
               }
             ]
           }
         ]
       },
      {
        name: 'Setting',
        path: 'setting',
        redirect: '/setting/cache/clear',
        component: PageView,
        meta: { title: '系统管理', keepAlive: false, icon: Icon['setting'], permission: ['setting'] },
        children: [
          {
            path: '/page/index',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/page/index'),
            meta: { title: '页面设计', keepAlive: false, permission: ['setting'] }
          },
          {
            path: '/page/update',
            component: () => import(/* webpackChunkName: "page" */ '@/views/page/update'),
            meta: { title: '编辑页面', keepAlive: false, permission: ['/page/update'] },
            hidden: true
          },
          {
            path: '/page/category',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/page/category'),
            meta: { title: '分类模板', keepAlive: false, permission: ['setting'] }
          },
          {
            path: '/setting/storage',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/Storage'),
            meta: { title: '上传设置', keepAlive: false, permission: ['/setting/storage'] },
            moduleKey: 'setting-storage',
          },
          {
              path: '/setting/sms',
                  component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/Sms'),
              meta: { title: '短信通知', keepAlive: false, permission: ['/setting/sms'] }
          },
          {
            path: '/setting/cache',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/cache'),
            meta: { title: '清理缓存', keepAlive: false, permission: ['setting'] }
          },
          {
            path: '/setting/science',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/science'),
            meta: { title: '环境检测', keepAlive: false, permission: ['setting'] }
          },
          {
            path: '/setting/timer',
            component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/timer'),
            meta: { title: '定时任务', keepAlive: false, permission: ['setting'] }
          }
          // {
          //   path: '/setting/queue',
          //   component: () => import(/* webpackChunkName: "setting" */ '@/views/setting/queue'),
          //   meta: { title: '队列服务', keepAlive: false, permission: ['setting'] }
          // }
        ]
      },
      // 数据统计
      {
        path: '/statistics',
        name: 'statistics',
        component: RouteView,
        meta: { title: '数据统计', icon: Icon.user, permission: ['/statistics'] },
        children: [
          {
            path: '/statistics/index',
            component: () => import(/* webpackChunkName: "content" */ '@/views/statistics/index'),
            meta: { title: '商家订单月统计', keepAlive: false, permission: ['/statistics/index'] }
          },
          {
            path: '/statistics/user',
            component: () => import(/* webpackChunkName: "content" */ '@/views/statistics/user'),
            meta: { title: '员工订单月统计', keepAlive: false, permission: ['/statistics/user'] }
          }
        ]
      },
      {
        name: 'Manage',
        path: '/manage',
        redirect: '/manage/renew',
        component: PageView,
        hidden: true,
        meta: { title: '管理员设置', keepAlive: false, permission: ['manage'] },
        children: [
          {
            // name: 'Renew',
            path: 'renew',
            component: () => import(/* webpackChunkName: "user" */ '@/views/manage/renew')
          }
        ]
      }

    ]
  },

  {
    path: '*', redirect: '/404', hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        // name: 'Login',
        path: 'login',
        meta: { title: '超级管理后台' },
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }

]
